<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.bootcss.com/vue/2.5.16/vue.min.js"></script>
    <script src="https://cdn.bootcss.com/jquery/3.3.0/jquery.min.js"></script>
    <title>Title</title>
</head>
<body>
<div class="row" style="padding-top: 30px;margin-left: 20px" id="test">
    <div class="col-md-6">
        <div class="row">
            <div class="col-md-12">
                <form role="form">
                    <div class="form-group">
                        <label for="img">图标地址</label>
                        <input type="text" class="form-control" id="img" v-model="imgUrl" placeholder="请输入图片地址">
                    </div>
                    <button type="button" class="btn btn-default" @click="updateFile">提交</button>
                </form>
            </div>
            <div class="col-md-12">
                <div class="row"><img :src="imgUrl" class="img-thumbnail"></div>
                <div class="row">
                    <div class="form-group">
                        <label >识别内容</label>
                        <textarea class="form-control" rows="3" v-model="text"></textarea>
                    </div>
                </div>
            </div>

        </div>

    </div>
    <div class="col-md-6">

    </div>
</div>
    <script>
        new Vue({
            el:'#test',
            data:{
                imgUrl:"",
                text:""

            },
            methods:{
                updateFile:function () {
                    if(this.imgUrl!=""||this.imgUrl!=null){
                        $.post("./api/orcUrl",{url:this.imgUrl},function (res) {
                            this.text=JSON.stringify(res);
                        }.bind(this))
                    }
                }
            }

        })
    </script>
</body>
</html>